package LeetCode.leetcode242;

import java.util.Locale;

public class Review3 {
    public boolean isAnagram(String s, String t) {
        String s1 = s.toLowerCase();
        String t1 = t.toLowerCase();
        int[] table = new int[26];
        for (int i = 0; i < s1.length(); i++) {
            char tmp = s1.charAt(i);
            table[tmp % 26]++;
        }
        for (int i = 0; i < t1.length(); i++) {
            char tmp = t1.charAt(i);
            if (table[tmp % 26]-- < 0){
                return false;
            }
        }
        for (int i = 0; i < table.length; i++) {
            if (table[i] != 0) return false;
        }
        return true;
    }
}
